/*
 * Ojo.cpp
 *
 *  Created on: 02/10/2013
 *      Author: ezequiel
 */

#include "Ojo.h"

Ojo::Ojo() {
this->formaOjo = new EsferaCuadrado(0.85);
this->globo = new FormaHoyos();
this->globoA = new FormaHoyos();
}

Ojo::~Ojo() {
this->formaOjo->~EsferaCuadrado();
delete formaOjo;
delete this->globo;
delete this->globoA;
}

void Ojo::render(GLuint handle, glm::mat4* matModelo) {
	glm::mat4 matrizOjo = glm::rotate(*matModelo, -180.0f, glm::vec3(1.0, 0, 0));
	this->formaOjo->render(handle, &matrizOjo);

	glm::mat4 modelo1 = glm::translate(*matModelo,glm::vec3(0,-0.6,0.60));
	modelo1 = glm::rotate(modelo1, 90.0f,glm::vec3(0.0f,0.0,1.0));
	glm::mat4 modelo2  = glm::translate(*matModelo,glm::vec3(0,-0.6,0.60));
	modelo2 = glm::rotate(modelo2, 90.0f,glm::vec3(0.0f,0.0,1.0));

	modelo1 = glm::rotate(modelo1, 90.0f,glm::vec3(1.0f,0,0));
    modelo1 = glm::scale(modelo1, glm::vec3(0.1,0.1,0.1));
    globo->render(handle,&modelo1);
	modelo2 = glm::rotate(modelo2, -90.0f,glm::vec3(1.0f,0,0));
    modelo2 = glm::scale(modelo2, glm::vec3(0.1,-0.1,0.1));
    globoA->render(handle,&modelo2);


}

void Ojo::render(GLuint handle) {
}

void Ojo::setTextureId(int n, int globo) {
	this->formaOjo->setTextureId(n);
	this->globo->setTextureid(n);
	this->globoA->setTextureid(globo);
}

void Ojo::setCam(Camara* cam, glm::mat4 pr) {
	this->formaOjo->setCam(cam, pr);
	this->globo->setCam(cam, pr);
	this->globoA->setCam(cam , pr);
}
